<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>生成排班日期</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/bootstrap-responsive.min.css"/>" rel="stylesheet">
	<link id="base-style" href="<c:url value="/css/style.css"/>" rel="stylesheet">
	<link id="base-style-responsive" href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/index.css"/>" rel="stylesheet">
	<link rel="shortcut icon" href="<c:url value="/img/favicon.ico"/>">
	<link href="<c:url value="/css/page.css"/>" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/jquery.datetimepicker.css"/>"/>
	<link href="<c:url value="/css/but.css"/>" rel="stylesheet">
	
	<link rel="stylesheet" href="<c:url value="/css/calendar.css"/>">
	<link rel="stylesheet" href="<c:url value="/css/amazeui.min.css"/>">
	<link rel="stylesheet" href="<c:url value="/css/timedropper.css"/>">
	
	<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
	<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/layer/layer.js"/>"></script>
	<script src="<c:url value="/js/laydate/laydate.js"/>"></script>
	<script src="<c:url value="/js/build/jquery.datetimepicker.full.js"/>"></script>
</head>
 <script type="text/javascript">
 
 $(function(){ 
	 var msg="${msg}";
	 if(msg!=null&&msg!=""){
		 alert(msg);
		 window.parent.location.reload(); //刷新父页面
		 var index = parent.layer.getFrameIndex(window.name);  
		 parent.layer.close(index);  
	 }
 }); 
 
 
 


function submitForm(){
	var workday = "";
	var year=$(".cen_year").html();
	$(".able_day").each(function (){
		if($(this).hasClass("workday")
				||$(this).hasClass("lawday")
				||$(this).hasClass("tradeday")
				||$(this).hasClass("freeday")){
			workday += $(this).attr("colspanvale")+"-"+$(this).attr("shiid") + ",";
		}
	});
	if(workday!=""){
		workday=workday.substring(0,workday.length-1);
	}
	$("#time").val(workday);
	$("#year").val(year);
	document.forms["frm"].submit();
}

var time=[${day}];
function loadLinkman(type){
	var year=$(".cen_year").html();
	if(type==1){
		year=parseInt(year)-1;
	}else{
		year=parseInt(year)+1;
	}
	var scheid=$("#scheid").val();
	 $.ajax({  
        url: '<%=basePath%>shift/generateSchedulingYearByid?year='+year+'&id='+scheid,
        type: 'GET',  
        async: false,  
        cache: false,
        contentType: false,  
        processData: false,  
        dataType: "json",
        success: function (result) {
       	 if(result.data.length != 0){
			var test='['+result.data.toString()+' ]' ;
			var obj2=eval("("+test+")"); 
			time=obj2;
       	 }else{
       		time="";
       	 }
        }
   });
}
function loadLinkmanyear(year){
	var scheid=$("#scheid").val();
	 $.ajax({  
        url: '<%=basePath%>shift/generateSchedulingYearByid?year='+year+'&id='+scheid,
        type: 'GET',  
        async: false,  
        cache: false,
        contentType: false,  
        processData: false,  
        dataType: "json",
        success: function (result) {
       	 if(result.data.length != 0){
			var test='['+result.data.toString()+' ]' ;
			var obj2=eval("("+test+")"); 
			time=obj2;
       	 }else{
       		time="";
       	 }
        }
   });
}

function closebutton() {
	var index = parent.layer.getFrameIndex(window.name);  
 	parent.layer.close(index);  
 }

 </script>
<body>
<div id="div1"></div>
		<!--录入信息口-->
		<div class="am-modal am-modal-no-btn  hd_info_modal" tabindex="-1" id="calendar-modal-1">
		  <div class="am-modal-dialog radius">
		    <div class="am-modal-hd">设置上班时间
		      <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    </div>
		    <div class="am-modal-bd">
		      <div class="am-margin-sm">
		      	<form action="" class="am-form am-form-inline">
		      	  <div class="hd-work-type">
		      	  	<div class="hd-work-block">
			      	  	<label class="hd-type-label" >类型:</label>
			      	  	<div class="hd-type-select">
			      	  		<select data-am-selected class="am-u-sm-10" id="hd-type-option">
			      	  		  <c:forEach items="${list }" var="a">
								  <option value="${a.colour }"  schevalue="${a.id }">${a.name }</option>
							  </c:forEach>
							  <option value="1" selected  schevalue="0">休息日期</option>
							<!--   <option value="freeday" >非工作日</option>
								  <option value="workday"  schevalue="6">${a.name }</option>
							  <option value="lawday" >法定假日</option>
							  <option value="tradeday" >调休日</option> -->
							</select>
			      	  	</div>
		      	  	</div>
		      	  	<div class="stone"></div>
		      	  	
		      	  </div>
		      	 <div class="hd-work-date">
		      	 	  <div class="hd-work-block">
			      	 	  	<label for="hd-start-date" class="am-form-label">时间:</label>
					      	<div class="am-form-group am-form-icon">
				      	  		<i class="am-icon-calendar"></i>
						    	<input id="hd-start-date" type="text" class="am-form-field" placeholder="开始日期" data-am-datepicker readonly required>
							</div>
		      	 	  </div>
		      	  	  <div class="hd-work-block">
			      	  	  <label for="hd-end-date" class="am-form-label">至</label>
						  <div class="am-form-group am-form-icon">
						    <i class="am-icon-calendar"></i>
						    <input id="hd-end-date" type="text" class="am-form-field" placeholder="结束日期" data-am-datepicker readonly required>
						  </div>
		      	  	  </div>
		      	  </div>
				  <div class="hd-work-btns">
				  	<button type="button" class="am-btn am-btn-secondary" id="calendar_confirm_btn">添加</button>
				  	<button type="button" class="am-btn am-btn-default" onClick="close_modal();">取消</button>
				  </div>
				  <div class="stone"></div>
				</form>
		      </div>
		    </div>
		  </div>
		</div>
		<form name="frm" id="frm" method="post" action="<%=basePath%>shift/generate">
			<input type="hidden" id="scheid" name="scheid"  value="${scheid }">
			<input type="hidden" id="time" name="time"  value="">
			<input type="hidden" id="year" name="year"  value="">
			<div id="content" >
				<div style="margin-left:250px;">
					<table id="tab">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="5" style="width:100%;">
								<div>
									<button style="background-color:#f55353;" type="button" onclick="closebutton();" id="output1">关闭</button>
									<button class="but" type="button" id="output" onclick="submitForm();">确定</button>
								</div>
							</td>
						</tr>
					  </tbody>
				  </table>            
				</div>	
			</div>
		</form>
</body>
	<script src="<c:url value="/js/jquery.min.js"/>"></script>
	<script src="<c:url value="/js/amazeui.min.js"/>" charset="utf-8"></script>
	<script src="<c:url value="/js/timedropper.js"/>" charset="utf-8"></script>
	<script src="<c:url value="/js/calendar.js"/>" charset="utf-8"></script>
	<script type="text/javascript">
			/*日历*/
			loading_calendar("div1","cn");
	</script>
</html>
